<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div style="text-align: center;">
    <h5>
        Welcome
    </h5>
    <div id="timing"></div>
</div>
<script>
    var socket = null;

    if (window.WebSocket) {
        var protocol = window.location.protocol;
        protocol = protocol == 'https:'?"wss":"ws";
        var hostname = window.location.hostname;
        var port = window.location.port;
        var path = protocol + "://" + hostname + ":" + port + "/index";
        socket = new WebSocket(path);
    } else {
        console.log("Not support webSocket")
    }

    socket.onerror = function(e) {
        console.error(e);
    };

    socket.onopen = function(event) {
        console.log("open");
    }

    socket.onmessage = function(event) {
        console.log(event.data);
    }

    socket.onclose = function() {
        console.log("close");
    }

    window.onbeforeunload = function() {
        socket.close();
    }

    function send(message) {
        socket.send(message);
    }

</script>
<script>
    window.onload = function(){
        var url = '[[@{/}]]' + 'dzh/build/index.html';
        var t = 3000;
        setTimeout(function(){
            window.location.href = url;
        },t);
        var tag = document.getElementById("timing");
        tag.innerHTML = t/1000;
        var t_animate = tag.animate([{"fontSize": "55px"}],{duration:1000,iterations:Infinity})
        var interval;
        interval = setInterval(function(){
            var currentT = parseInt(tag.innerHTML);
            if(currentT < 1){
                t_animate && t_animate.cancel();
                interval && clearInterval(interval);
                tag.innerHTML = "";
            }else{
                tag.innerHTML = currentT - 1;
            }
        },1000)
    }
</script>

</body>

</html>